package com.platform.api.modular.demo.controller;

import com.platform.api.modular.demo.entity.SysApp;
import com.platform.api.modular.demo.param.DemoParam;
import com.platform.api.modular.demo.result.SysAppResult;
import com.platform.api.modular.demo.service.SysAppService;
import com.platform.core.annotion.BusinessLog;
import com.platform.core.annotion.Permission;
import com.platform.core.enums.LogAnnotionOpTypeEnum;
import com.platform.core.pojo.page.PageResult;
import com.platform.core.pojo.response.ResponseData;
import com.platform.core.pojo.response.SuccessResponseData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 代码生成器
 */
@Api(tags = "测试模块")
@RestController
public class DemoController {

    @Resource
    private SysAppService sysAppService;

    /**
     * 数据访问
     * @return
     */
    @ApiOperation(value = "测试开放接口")
    @Permission
    @GetMapping("/api/demo")
    @BusinessLog(title = "测试开放接口_查询1", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData demo(DemoParam demoParam) {
//        PageResult<SysAppResult> sysAppResultPageResult = sysAppService.page2(demoParam);
//        return new SuccessResponseData(sysAppResultPageResult);
        DemoParam sysUserParam = new DemoParam();
        sysAppService.addDemo(sysUserParam);
        return new SuccessResponseData();
    }

    /**
     * 数据访问
     * @return
     */
    @ApiOperation(value = "测试开放接口")
    @Permission
    @GetMapping("/api/demo2")
    @BusinessLog(title = "测试开放接口_查询1", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData demo2() {
        return new SuccessResponseData("测试数据返回");
    }

    public static void main(String[] args) {
        String osName = System.getProperty("os.name");
        System.out.println(osName.toLowerCase().contains("win"));
    }
}
